﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Rappelz.GameServer;

namespace GameServer
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Globals.AppPath = System.Windows.Forms.Application.StartupPath;
            try
            {
                Application.Run(new formGameServer());
            }
            catch (System.IO.FileNotFoundException ex)
            {
                System.Windows.Forms.MessageBox.Show("A critical file was not found :" + Environment.NewLine + ex.FileName);
                if (Globals.Log != null)
                    Globals.Log.Fatal("A fatal exception occured :" + Environment.NewLine + ex.ToString());
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("A fatal exception occured :" + Environment.NewLine + Environment.NewLine + ex.ToString(), "Exception");
                if (Globals.Log != null)
                    Globals.Log.Fatal("A fatal exception occured :" + Environment.NewLine + ex.ToString());
            }
        }
    }
}
